/*
 * @Author: Jimmy
 * @LastModifiedBy: Jimmy
 * @Date: 2025-02-25 20:35:26
 * @LastEditTime: 2025-02-26 21:36:50
 * @FilePath: /monitor_belt/src/store/conveyor.ts
 */
import { remoteConveyors } from "@/api/system";
import { TConveyor } from "@/views/setting/basic";
import { create } from "zustand";

export const useStore:any = create((set)=>{
    return {
        conveyorList:[],
        status:false,
        updateStatus:(state:boolean)=>{
            set({'status':state})
        },
        updateConveyorList:(list:TConveyor[])=>{
            console.log(list)
            set({conveyorList:list})
        },
        asyncGetConveyorList:async()=>{
            let res = await remoteConveyors();
            let { data } = res;
            set({conveyorList:data?.length?[...data]:[]})
        }
    }
})